package com.hand.exam.controller;

import com.hand.exam.annoction.TestAnnoction;
import com.hand.exam.domain.Warehouse;
import com.hand.exam.service.IWarehouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 马旭阳
 * @date2019/7/20
 */
@RestController
@RequestMapping(value = "/warehouse")
public class WarehouseController {
    @Autowired
    private IWarehouseService warehouseService;

    @GetMapping(value = "/{id}")
    @TestAnnoction(value = true)
    public Warehouse queryWarehouseById(@PathVariable("id") Long id){
        return  warehouseService.queryWarehouseById(id);
    }
    @GetMapping(value = "/bean")
    @TestAnnoction(value = true)
    public Warehouse queryWarehouse(@RequestBody Warehouse warehouse){
        return warehouseService.queryWarehouse(warehouse);
    }
     @PostMapping
     @TestAnnoction(value = true)
    public void insertWarehouse(@RequestBody Warehouse warehouse){
        warehouseService.insertWarehouse(warehouse);
     }
     @PutMapping
     @TestAnnoction(value = true)
    public void updateWarehouse(@RequestBody Warehouse warehouse){
        warehouseService.updateWarehouse(warehouse);
     }
     @DeleteMapping
     @TestAnnoction(value = true)
    public void deleteWarehouse(@RequestParam("id") Long id){
        warehouseService.deleteWarehouse(id);
     }
}
